<!--
	作者：956911785@qq.com
	时间：2018-10-18
	描述：社团活动辅导班-添加
-->

<template>
	<Tcontent ref="Tcontent" :teas="editparams" :title="title" 
		@addsave="editsave" @closeModal="closeModal"></Tcontent>
</template>

<script>
	import Tcontent from "./Tcontent";
	export default {
		name:"editstkfdb",
		props: {
    		editparams:{
    			type:Object,	
    			default: function() {
					return null
				}
    		},
    	},
		data() {
			return {
				title:'修改辅导班'
			}
		},
		components: {
			Tcontent
		},
		methods: {
			editsave:function(datas){	
				const stkdata={...datas};
				
				var stksf=[];
				const sfdata=stkdata.stksf;
				for(var i=0;i<sfdata.length;i++){
					var sfxm=sfdata[i];
					stksf.push(sfxm);
				}
				
				var stk_teacher=[];
				const teadata=stkdata.teachers;
				for(var i=0;i<teadata.length;i++){
					var tea={
						tid:teadata[i].tid
					};
					stk_teacher.push(tea);
				}
				
				const params={
					sid:stkdata.sid,
					mc:stkdata.mc,
					jj:stkdata.jj,
					fy:stkdata.fy,
					xe:stkdata.xe,
					sksj:stkdata.sksj,
					skdd:stkdata.skdd,
					bmzlsm:stkdata.bmzlsm,
					stksf:JSON.stringify(stksf),
					stk_teacher:JSON.stringify(stk_teacher),
				};
				
				//保存
				this.$http.post("/host/stgl/sthd/EditStkfdb.html",params)
				.then(result => {
					//添加成功 刷新页面
					if(result){
						this.$Modal.success({
                            title: "成功",
                            content: "修改成功！",
                            onOk: () => {
                            	this.$refs.Tcontent.modal0 = false;
					    		this.$emit("reload");
                            }
                       });
					}else{
						this.$Modal.error({
                            title: "失败",
                            content: "修改失败！"
                        });	
					}
				});
	        },
			closeModal(){
				this.$refs.Tcontent.modal0 = false;
			},
			openmodal(){
				this.$refs.Tcontent.modal0 = true;
			}
		},
		mounted() {

		},
		watch:{
			
		},
		computed: {
			
		}
		
	}
</script>

<style scoped="scoped">
	
</style>



